<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>项目客户账户信息表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">项目ID</div>
                    <div class="field">
                        <input name="prjId" id="prjId" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">校验状态</div>
                    <div class="field">
                        <input name="chkRstCd" id="chkRstCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>

                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/project/prjCstAccInfo/initList.do',
            method: 'get',
            columns: [
                {display: '项目ID', name: 'prjId', width: 130, align: 'left', enabledSort: false},
                /*{display: '客户ID', name: 'cstId', minWidth: 100, align: 'left', enabledSort: false},*/
                {display: '客户名称', name: 'cstNm', minWidth: 80, align: 'left', enabledSort: false},
                {display: '手机号', name: 'mp', width: 90, align: 'left', enabledSort: false},
                {display: '证件号码', name: 'certNo', width: 150, align: 'left', enabledSort: false},
                {display: '银行账号', name: 'accNo', minWidth: 180, align: 'left', enabledSort: false},
                //{display: '证件类型（CST0005）', name: 'certTypCdNm', minWidth: 100, align: 'left', enabledSort: false},
                //{display: '银行代码（CST0014）', name: 'bkCdNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '开户银行', name: 'bkNm', minWidth: 150, align: 'left', enabledSort: false},
                {display: '开户行号', name: 'bkNo', minWidth: 90, align: 'left', enabledSort: false},
                {display: '校验结果', name: 'chkRstCdNm', minWidth: 100, align: 'left', enabledSort: false},
                {display: '结果描述', name: 'rstDesc', minWidth: 200, align: 'left', enabledSort: false,
                    render: function (rowdata, rowindex, value) {
                        var h = '<span class="gridTip" title="' + value + '">' + value + '</span>';
                        if (value == null) {
                            return '<span></span>';
                        } else {
                            return h;
                        }
                    }
                },
                {display: '操作', name: '', minWidth: 120, align: 'left', enabledSort: false,
                    render: function (rowdata, rowindex, value){
                        var h ="";
                        h+='<a class="sq-button-hasicon" href="javascript:modifyBtn(';
                        h+="'"+rowdata.id+"'";
                        h+=')"><i class="sqBtnIco_4"></i>修改</a>'
                        h+='<a class="sq-button-hasicon" href="javascript:valideBtn(';
                        h+="'"+rowdata.id+"'";
                        h+=')"><i class="sqBtnIco_3"></i>校验</a>'
                        return h;
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        grid.setHeight(100);

        //初始化
        $("#chkRstCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
        });
        $("#searchBar").ligerForm();
        liger.get("chkRstCd").setData(${chkRstCdList});

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });

        callback = function () {
            grid.reload();
        };

    });

    //修改
    function modifyBtn(_id){
        $.ligerDialog.open({
            width: 550,
            height: 400,
            title: '修改项目客户账户信息表',
            url: '<%=path%>/project/prjCstAccInfo/toModifyPage.do?id=' + _id
        });
    }
    //校验
    function valideBtn(_id){
        var wait_dialog;
        $.ajax({
            type: 'get',
            dataType: 'json',
            url: '<%=path%>/project/prjCstAccInfo/valide.do?id=' + _id,
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    parent.$("#clearBtn").click();
                    parent.$("#searchBtn").click();
                    frameElement.dialog.close();
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

</script>

</body>
</html>
